<%--
/**
* Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>


<%@page import="com.hotel.test.service.persistence.LocalUtil"%>
<%@page import="com.hotel.test.service.LocalLocalServiceUtil"%>
<%@include file="/html/init.jsp" %>
<%
	String url = (String)request.getAttribute("url");
		if(url==null)
		{
			url = PortalUtil.getCurrentURL(request);
			//System.out.println(url);
		}
		
%>



<portlet:actionURL var="switchActionURL" name="switchAction">
	<portlet:param name="redirectTo" value="<%=url %>"></portlet:param>
</portlet:actionURL>

<form action="<%=switchActionURL%>" method="post">
	<input type="submit"  name="switchAction" value="add Local"/>
	<input type="submit" name="switchAction" value="list Hotel" />
</form>

<liferay-ui:search-container emptyResultsMessage="there-are-no-products" delta="8">
<liferay-ui:search-container-results>
<%
List<Local> locals = LocalLocalServiceUtil.getAll();

results = ListUtil.subList(locals, searchContainer.getStart(), searchContainer.getEnd());
total = locals.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
%>
</liferay-ui:search-container-results>
<liferay-ui:search-container-row
className="com.hotel.test.model.Local"
keyProperty="localId" modelVar="local">
<liferay-ui:search-container-column-text
name="localId"
property="localId"
/>
<portlet:actionURL name="getHotels" var="getHotelURL">
	<portlet:param name="localId" value="<%=String.valueOf(local.getLocalId()) %>"></portlet:param>
	<portlet:param name="redirectTo" value="<%=url %>"></portlet:param>
</portlet:actionURL>

<liferay-ui:search-container-column-text  href="${getHotelURL}" name="name" property="localName"/>
<liferay-ui:search-container-column-jsp
path="/html/admin/admin_actions.jsp"
align="right"
/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>